package com.hopu.oa.service.impl.management;

import com.hopu.oa.dao.management.AttendanceManageDao;
import com.hopu.oa.entity.management.AoaAttendsList;
import com.hopu.oa.entity.management.AoaStatusList;
import com.hopu.oa.entity.management.AoaTypeList;
import com.hopu.oa.service.management.AttendanceManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: AttendanceManagementServiceImpl
 * @Description:
 * @Date: 2021/11/19 21:23
 */
@Service
public class AttendanceManagementServiceImpl implements AttendanceManagementService {


    @Autowired
    private AttendanceManageDao attendanceManageDao;


    /*
      @Description :  根据部门，角色 查询 考勤
      @Date   :  2021/11/19
      @Param  : [roleId, deptId]
      @return : java.util.List<com.hopu.oa.entity.management.AoaAttendsList>
     */
    @Override
    public List<AoaAttendsList> queryAttendanceByDeptAndRole(
            Integer roleId, Integer deptId, int index, int size, String baseKey, int typeId
    ) {
        return attendanceManageDao.queryAttendanceByDeptAndRole(roleId, deptId, index, size, baseKey, typeId);
    }


    /*
      @Description : 查询所有状态
      @Date   :  2021/11/19
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.management.AoaStatusList>
     */
    @Override
    public List<AoaStatusList> queryAllStatus(int tid) {
        return attendanceManageDao.queryAllStatus(tid);
    }


    /*
      @Description : 查询类型
      @Date   :  2021/11/19
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.management.AoaTypeList>
     */
    @Override
    public List<AoaTypeList> queryAllType() {
        return attendanceManageDao.queryAllType();
    }


    /*
      @Description : id 查询一个考勤
      @Date   :  2021/11/20
      @Param  : [aid]
      @return : com.hopu.oa.entity.management.AoaAttendsList
     */
    @Override
    public AoaAttendsList queryAttendanceById(String aid) {
        return attendanceManageDao.queryAttendanceById(aid);
    }


    /*
      @Description : 根据id修改考勤 状态
      @Date   :  2021/11/20
      @Param  : [aid, sid]
      @return : java.lang.Boolean
     */
    @Override
    public Boolean updateAttendanceStatusById(String aid, String sid) {
        return attendanceManageDao.updateAttendanceStatusById(aid, sid) > 0;
    }


    /*
      @Description : 根据id删除考勤
      @Date   :  2021/11/20
      @Param  : [parseInt]
      @return : boolean
     */
    @Override
    public boolean deleteAttendanceById(int aid) {
        return attendanceManageDao.deleteAttendanceById(aid) > 0;
    }


}
